package cn.itcast.day02.demo;

public class test04 {
    public static void main(String[] args) {

        /*int[] array = {10,20,30,40,50};
        printarray(array);
        System.out.println("========");
        printarray(array);*/
        int[] result = calculate(10,20,30);
        System.out.println("总和为"+ result[0]);
        System.out.println("平均值为" + result[1]);
    }

    public static void printarray(int[] array){
        for (int i = 0; i < array.length; i++) {
            System.out.println(array[i]);
        }
    }

    public static int[] calculate(int a, int b, int c) {
        int i = a + b + c;
        int j = i/3;
        int[] array = new int[2];
        array[0] = i;
        array[1] = j;
        return array;
    }
}
